package com.example;

import com.example.dao.UserDao;
import com.example.dao.impl.UserDaoImpl;
import com.example.service.impl.UserServiceImpl;
import com.example.servlet.UserServlet;

public class App {
    public static void main(String[] args) {
        // dao层
        UserDao userDao = new UserDaoImpl();
        // service层
        UserServiceImpl userService = new UserServiceImpl();
        // 搭建service层和dao层的依赖关系
        userService.setUserDao(userDao); // 依赖注入
        // 表现层
        UserServlet userServlet = new UserServlet(); // 里面service属性有值吗
        // 搭建UI层和service层的依赖关系：为属性赋值
        userServlet.setUserService(userService);
        userServlet.addUser();
    }
}
